# Contributor: Alex Yam <alex@alexyam.com>
# Maintainer: Alex Yam <alex@alexyam.com>
pkgname=libspng
pkgver=0.7.4
pkgrel=0
pkgdesc="modern alternative to libpng"
url="https://github.com/randy408/libspng"
arch="all"
license="BSD-2-Clause"
makedepends="meson zlib-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/randy408/libspng/archive/refs/tags/v$pkgver.tar.gz"

build() {
	case "$CARCH" in
	x86)
		local sseopt=false
		;;
	*)
		local sseopt=true
		;;
	esac
	abuild-meson \
		-Db_lto=true \
		-Denable_opt=$sseopt \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
cd729653599ed97f80d19f3048c1b3bc2ac16f922b3465804b1913bc45d9fc8b28b56bc2121fda36e9d3dcdd12612cced5383313b722a5342b613f8781879f1a  libspng-0.7.4.tar.gz
"
